<template>
	<view class="pages">
		<cu-custom bgColor="bg-white" :isBack="true" :isTitle="true" >
			<block slot="backText" class="titilestyle">{{title}}</block>
		
		</cu-custom>
		
		<view class="send-box">
			<view class="f-content">
				<textarea  focus="true" placeholder="请填写帖子内容" v-model="formData.content" />
			</view>
			
			<robby-image-upload v-model="imageData" @delete="deleteImage" @add="addImage"  limit=9
				:server-url-delete-image="serverUrlDeleteImage" :server-url="serverUrl" :fileKeyName="file">
			</robby-image-upload>
			
			<view class="sub-btn-box">
				<button class="submit-btn bg-blue" type="" @click="sub">提交审核</button>
			</view>
		</view>
		
	</view>


</template>

<script>
	import robbyImageUpload from '@/components/robby-image-upload/robby-image-upload.vue'
	export default {
		components: {
			robbyImageUpload
		},
		data() {
			return {
				title: "写帖子",
				content:"",
				imageData: [],
				serverUrl: this.apiHost + '/comm/imageUp',
				serverUrlDeleteImage: this.apiHost + '/comm/delupload',
				formData: {
					content: '',
					area_id: uni.getStorageSync('area_id'),
					pics: {},
				},
				file: ''
			}
		},
		methods: {
			upDataLogin(){
				
			},
			deleteImage: function(e) {
			
			},
			addImage: function(e) {
				
				this.formData.pics = e.allImages
			},

			sub() {
				this.apiRequest('/buyer/subForum', this.formData,1).then(res => {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					if (res.code == 200) {
						setTimeout(()=>{
							uni.navigateBack({
								delta: 1
							});
						},2000)
						
					}
				})
			},
		}
	}
</script>

<style>
	.send-box {
		width: 90%;
		margin-left: 5%;
		border-radius: 20rpx;
	}

	textarea {
		width: 100%;
		height: 280rpx;
		color: #898989;
		padding: 24rpx 5%;
		background: #EEEEEE;
		margin-top: 10rpx;
		border-radius: 20rpx;
	}

	.c-btn-box button {
		width: 100%;
		height: 80rpx;
		border-radius: 20rpx;
		font-size: $fontSize;
		background-color: #00A0DC;
		line-height: 80rpx;
		color: #FFFFFF;
	}
</style>
